<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QRegion Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QRegion Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QRegion class specifies a clip region for a painter.
<a href="#details">More...</a></p>

<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qregion.html#RegionType-enum">RegionType</a></b> { Rectangle, Ellipse }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qregion.html#QRegion">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qregion.html#QRegion-2">__init__</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, RegionType&#160;<i>type</i>&#160;=&#160;QRegion.Rectangle)</li><li><div class="fn" /><b><a href="qregion.html#QRegion-3">__init__</a></b> (<i>self</i>, QRect&#160;<i>r</i>, RegionType&#160;<i>type</i>&#160;=&#160;QRegion.Rectangle)</li><li><div class="fn" /><b><a href="qregion.html#QRegion-4">__init__</a></b> (<i>self</i>, QPolygon&#160;<i>a</i>, Qt.FillRule&#160;<i>fillRule</i>&#160;=&#160;Qt.OddEvenFill)</li><li><div class="fn" /><b><a href="qregion.html#QRegion-5">__init__</a></b> (<i>self</i>, QBitmap&#160;<i>bitmap</i>)</li><li><div class="fn" /><b><a href="qregion.html#QRegion-6">__init__</a></b> (<i>self</i>, QRegion&#160;<i>region</i>)</li><li><div class="fn" /><b><a href="qregion.html#QRegion-7">__init__</a></b> (<i>self</i>, QVariant&#160;<i>variant</i>)</li><li><div class="fn" />QRect <b><a href="qregion.html#boundingRect">boundingRect</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qregion.html#contains">contains</a></b> (<i>self</i>, QPoint&#160;<i>p</i>)</li><li><div class="fn" />bool <b><a href="qregion.html#contains-2">contains</a></b> (<i>self</i>, QRect&#160;<i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#eor">eor</a></b> (<i>self</i>, QRegion&#160;<i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#intersect">intersect</a></b> (<i>self</i>, QRegion&#160;<i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#intersected">intersected</a></b> (<i>self</i>, QRegion&#160;<i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#intersected-2">intersected</a></b> (<i>self</i>, QRect&#160;<i>r</i>)</li><li><div class="fn" />bool <b><a href="qregion.html#intersects">intersects</a></b> (<i>self</i>, QRegion&#160;<i>r</i>)</li><li><div class="fn" />bool <b><a href="qregion.html#intersects-2">intersects</a></b> (<i>self</i>, QRect&#160;<i>r</i>)</li><li><div class="fn" />bool <b><a href="qregion.html#isEmpty">isEmpty</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qregion.html#numRects">numRects</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qregion.html#rectCount">rectCount</a></b> (<i>self</i>)</li><li><div class="fn" />list-of-QRect <b><a href="qregion.html#rects">rects</a></b> (<i>self</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#subtract">subtract</a></b> (<i>self</i>, QRegion&#160;<i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#subtracted">subtracted</a></b> (<i>self</i>, QRegion&#160;<i>r</i>)</li><li><div class="fn" /><b><a href="qregion.html#swap">swap</a></b> (<i>self</i>, QRegion&#160;<i>other</i>)</li><li><div class="fn" /><b><a href="qregion.html#translate">translate</a></b> (<i>self</i>, int&#160;<i>dx</i>, int&#160;<i>dy</i>)</li><li><div class="fn" /><b><a href="qregion.html#translate-2">translate</a></b> (<i>self</i>, QPoint&#160;<i>p</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#translated">translated</a></b> (<i>self</i>, int&#160;<i>dx</i>, int&#160;<i>dy</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#translated-2">translated</a></b> (<i>self</i>, QPoint&#160;<i>p</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#unite">unite</a></b> (<i>self</i>, QRegion&#160;<i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#united">united</a></b> (<i>self</i>, QRegion&#160;<i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#united-2">united</a></b> (<i>self</i>, QRect&#160;<i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#xored">xored</a></b> (<i>self</i>, QRegion&#160;<i>r</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />QRegion <b><a href="qregion.html#__add__">__add__</a></b> (<i>self</i>, QRegion&#160;<i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__add__-2">__add__</a></b> (<i>self</i>, QRect&#160;<i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__and__">__and__</a></b> (<i>self</i>, QRegion&#160;<i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__and__-2">__and__</a></b> (<i>self</i>, QRect&#160;<i>r</i>)</li><li><div class="fn" />int <b><a href="qregion.html#__bool__">__bool__</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qregion.html#__contains__">__contains__</a></b> (<i>self</i>, QPoint&#160;<i>p</i>)</li><li><div class="fn" />int <b><a href="qregion.html#__contains__-2">__contains__</a></b> (<i>self</i>, QRect&#160;<i>r</i>)</li><li><div class="fn" />bool <b><a href="qregion.html#__eq__">__eq__</a></b> (<i>self</i>, QRegion&#160;<i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__iadd__">__iadd__</a></b> (<i>self</i>, QRegion&#160;<i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__iadd__-2">__iadd__</a></b> (<i>self</i>, QRect&#160;<i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__iand__">__iand__</a></b> (<i>self</i>, QRegion&#160;<i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__iand__-2">__iand__</a></b> (<i>self</i>, QRect&#160;<i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__ior__">__ior__</a></b> (<i>self</i>, QRegion&#160;<i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__isub__">__isub__</a></b> (<i>self</i>, QRegion&#160;<i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__ixor__">__ixor__</a></b> (<i>self</i>, QRegion&#160;<i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__mul__">__mul__</a></b> (<i>self</i>, QMatrix&#160;<i>m</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__mul__-2">__mul__</a></b> (<i>self</i>, QTransform&#160;<i>m</i>)</li><li><div class="fn" />bool <b><a href="qregion.html#__ne__">__ne__</a></b> (<i>self</i>, QRegion&#160;<i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__or__">__or__</a></b> (<i>self</i>, QRegion&#160;<i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__sub__">__sub__</a></b> (<i>self</i>, QRegion&#160;<i>r</i>)</li><li><div class="fn" />QRegion <b><a href="qregion.html#__xor__">__xor__</a></b> (<i>self</i>, QRegion&#160;<i>r</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QRegion class specifies a clip region for a painter.</p>
<p>QRegion is used with <a href="qpainter.html#setClipRegion">QPainter.setClipRegion</a>() to
limit the paint area to what needs to be painted. There is also a
<a href="qwidget.html#repaint">QWidget.repaint</a>() function that
takes a QRegion parameter. QRegion is the best tool for minimizing
the amount of screen area to be updated by a repaint.</p>
<p>This class is not suitable for constructing shapes for
rendering, especially as outlines. Use <a href="qpainterpath.html">QPainterPath</a> to create paths and shapes for
use with <a href="qpainter.html">QPainter</a>.</p>
<p>QRegion is an <a href="implicit-sharing.html#implicitly-shared">implicitly shared</a>
class.</p>
<a id="creating-and-using-regions" name="creating-and-using-regions" />
<h3>Creating and Using Regions</h3>
<p>A region can be created from a rectangle, an ellipse, a polygon
or a bitmap. Complex regions may be created by combining simple
regions using <a href="qregion.html#united">united</a>(), <a href="qregion.html#intersected">intersected</a>(), <a href="qregion.html#subtracted">subtracted</a>(), or <a href="qregion.html#xored">xored</a>() (exclusive or). You can move a
region using <a href="qregion.html#translate">translate</a>().</p>
<p>You can test whether a region <a href="qregion.html#isEmpty">isEmpty</a>() or if it <a href="qregion.html#contains">contains</a>() a <a href="qpoint.html">QPoint</a> or <a href="qrect.html">QRect</a>. The
bounding rectangle can be found with <a href="qregion.html#boundingRect">boundingRect</a>().</p>
<p>The function <a href="qregion.html#rects">rects</a>() gives a
decomposition of the region into rectangles.</p>
<p>Example of using complex regions:</p>
<pre class="cpp">
 <span class="type">void</span> MyWidget<span class="operator">.</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
 {
     <span class="type">QRegion</span> r1(<span class="type"><a href="qrect.html">QRect</a></span>(<span class="number">100</span><span class="operator">,</span> <span class="number">100</span><span class="operator">,</span> <span class="number">200</span><span class="operator">,</span> <span class="number">80</span>)<span class="operator">,</span>    <span class="comment">// r1: elliptic region</span>
                <span class="type">QRegion</span><span class="operator">.</span>Ellipse);
     <span class="type">QRegion</span> r2(<span class="type"><a href="qrect.html">QRect</a></span>(<span class="number">100</span><span class="operator">,</span> <span class="number">120</span><span class="operator">,</span> <span class="number">90</span><span class="operator">,</span> <span class="number">30</span>));    <span class="comment">// r2: rectangular region</span>
     <span class="type">QRegion</span> r3 <span class="operator">=</span> r1<span class="operator">.</span>intersected(r2);        <span class="comment">// r3: intersection</span>

     <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
     painter<span class="operator">.</span>setClipRegion(r3);
     <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>                                     <span class="comment">// paint clipped graphics</span>
 }
</pre>
<a id="additional-license-information" name="additional-license-information" />
<h3>Additional License Information</h3>
<p>On Embedded Linux, Windows CE and X11 platforms, parts of this
class rely on code obtained under the following licenses:</p>
<div class="LegaleseLeft">
<p>Copyright (c) 1987 X Consortium</p>
<p>Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:</p>
<p>The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.</p>
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>
<p>Except as contained in this notice, the name of the X Consortium
shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the X Consortium.</p>
</div>
<br />
<div class="LegaleseLeft">
<p>Copyright 1987 by Digital Equipment Corporation, Maynard,
Massachusetts.</p>
<p>All Rights Reserved</p>
<p>Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that copyright notice and this permission
notice appear in supporting documentation, and that the name of
Digital not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.</p>
<p>DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.</p>
</div>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="RegionType-enum" />QRegion.RegionType</h3><p>Specifies the shape of the region to be created.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QRegion.Rectangle</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">the region covers the entire rectangle.</td>
</tr>
<tr>
<td class="topAlign"><tt>QRegion.Ellipse</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">the region is an ellipse inside the
rectangle.</td>
</tr>
</table>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QRegion" />QRegion.__init__ (<i>self</i>)</h3><p>Constructs an empty region.</p>
<p><b>See also</b> <a href="qregion.html#isEmpty">isEmpty</a>().</p>


<h3 class="fn"><a name="QRegion-2" />QRegion.__init__ (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, <a href="qregion.html#RegionType-enum">RegionType</a>&#160;<i>type</i>&#160;=&#160;QRegion.Rectangle)</h3><p>Constructs a rectangular or elliptic region.</p>
<p>If <i>t</i> is <tt>Rectangle</tt>, the region is the filled
rectangle (<i>x</i>, <i>y</i>, <i>w</i>, <i>h</i>). If <i>t</i> is
<tt>Ellipse</tt>, the region is the filled ellipse with center at
(<i>x</i> + <i>w</i> / 2, <i>y</i> + <i>h</i> / 2) and size
(<i>w</i> ,<i>h</i>).</p>


<h3 class="fn"><a name="QRegion-3" />QRegion.__init__ (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>r</i>, <a href="qregion.html#RegionType-enum">RegionType</a>&#160;<i>type</i>&#160;=&#160;QRegion.Rectangle)</h3><p>Constructs a polygon region from the point array <i>a</i> with
the fill rule specified by <i>fillRule</i>.</p>
<p>If <i>fillRule</i> is <a href="qt.html#FillRule-enum">Qt.WindingFill</a>, the polygon region is
defined using the winding algorithm; if it is <a href="qt.html#FillRule-enum">Qt.OddEvenFill</a>, the odd-even fill
algorithm is used.</p>
<p><b>Warning:</b> This constructor can be used to create complex
regions that will slow down painting when used.</p>


<h3 class="fn"><a name="QRegion-4" />QRegion.__init__ (<i>self</i>, <a href="qpolygon.html">QPolygon</a>&#160;<i>a</i>, <a href="qt.html#FillRule-enum">Qt.FillRule</a>&#160;<i>fillRule</i>&#160;=&#160;Qt.OddEvenFill)</h3><h3 class="fn"><a name="QRegion-5" />QRegion.__init__ (<i>self</i>, <a href="qbitmap.html">QBitmap</a>&#160;<i>bitmap</i>)</h3><p>Constructs a new region which is equal to region <i>r</i>.</p>


<h3 class="fn"><a name="QRegion-6" />QRegion.__init__ (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>region</i>)</h3><p>Constructs a region from the bitmap <i>bm</i>.</p>
<p>The resulting region consists of the pixels in bitmap <i>bm</i>
that are <a href="qt.html#GlobalColor-enum">Qt.color1</a>, as if
each pixel was a 1 by 1 rectangle.</p>
<p>This constructor may create complex regions that will slow down
painting when used. Note that drawing masked pixmaps can be done
much faster using <a href="qpixmap.html#setMask">QPixmap.setMask</a>().</p>


<h3 class="fn"><a name="QRegion-7" />QRegion.__init__ (<i>self</i>, QVariant&#160;<i>variant</i>)</h3><p>This is an overloaded function.</p>
<p>Create a region based on the rectange <i>r</i> with region type
<i>t</i>.</p>
<p>If the rectangle is invalid a null region will be created.</p>
<p><b>See also</b> <a href="qregion.html#RegionType-enum">QRegion.RegionType</a>.</p>


<h3 class="fn"><a name="boundingRect" /><a href="qrect.html">QRect</a> QRegion.boundingRect (<i>self</i>)</h3><p>Returns the bounding rectangle of this region. An empty region
gives a rectangle that is <a href="qrect.html#isNull">QRect.isNull</a>().</p>


<h3 class="fn"><a name="contains" />bool QRegion.contains (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p</i>)</h3><p>Returns true if the region contains the point <i>p</i>;
otherwise returns false.</p>


<h3 class="fn"><a name="contains-2" />bool QRegion.contains (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>r</i>)</h3><p>This is an overloaded function.</p>
<p>Returns true if the region overlaps the rectangle <i>r</i>;
otherwise returns false.</p>


<h3 class="fn"><a name="eor" /><a href="qregion.html">QRegion</a> QRegion.eor (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>r</i>)</h3><h3 class="fn"><a name="intersect" /><a href="qregion.html">QRegion</a> QRegion.intersect (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>r</i>)</h3><h3 class="fn"><a name="intersected" /><a href="qregion.html">QRegion</a> QRegion.intersected (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>r</i>)</h3><p>Returns a region which is the intersection of this region and
<i>r</i>.</p>
<p class="centerAlign"><img alt="Region Intersection" src="images/rintersect.png" /></p>
<p>The figure shows the intersection of two elliptical regions.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qregion.html#subtracted">subtracted</a>(), <a href="qregion.html#united">united</a>(), and <a href="qregion.html#xored">xored</a>().</p>


<h3 class="fn"><a name="intersected-2" /><a href="qregion.html">QRegion</a> QRegion.intersected (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>r</i>)</h3><p>Returns a region which is the intersection of this region and
the given <i>rect</i>.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qregion.html#subtracted">subtracted</a>(), <a href="qregion.html#united">united</a>(), and <a href="qregion.html#xored">xored</a>().</p>


<h3 class="fn"><a name="intersects" />bool QRegion.intersects (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>r</i>)</h3><p>Returns true if this region intersects with <i>region</i>,
otherwise returns false.</p>
<p>This function was introduced in Qt 4.2.</p>


<h3 class="fn"><a name="intersects-2" />bool QRegion.intersects (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>r</i>)</h3><p>Returns true if this region intersects with <i>rect</i>,
otherwise returns false.</p>
<p>This function was introduced in Qt 4.2.</p>


<h3 class="fn"><a name="isEmpty" />bool QRegion.isEmpty (<i>self</i>)</h3><p>Returns true if the region is empty; otherwise returns false. An
empty region is a region that contains no points.</p>
<p>Example:</p>
<pre class="cpp">
 <span class="type"><a href="qregion.html">QRegion</a></span> r1(<span class="number">10</span><span class="operator">,</span> <span class="number">10</span><span class="operator">,</span> <span class="number">20</span><span class="operator">,</span> <span class="number">20</span>);
 r1<span class="operator">.</span>isEmpty();               <span class="comment">// false</span>

 <span class="type"><a href="qregion.html">QRegion</a></span> r3;
 r3<span class="operator">.</span>isEmpty();               <span class="comment">// true</span>

 <span class="type"><a href="qregion.html">QRegion</a></span> r2(<span class="number">40</span><span class="operator">,</span> <span class="number">40</span><span class="operator">,</span> <span class="number">20</span><span class="operator">,</span> <span class="number">20</span>);
 r3 <span class="operator">=</span> r1<span class="operator">.</span><a href="qregion.html#intersected">intersected</a>(r2);    <span class="comment">// r3: intersection of r1 and r2</span>
 r3<span class="operator">.</span>isEmpty();               <span class="comment">// true</span>

 r3 <span class="operator">=</span> r1<span class="operator">.</span><a href="qregion.html#united">united</a>(r2);         <span class="comment">// r3: union of r1 and r2</span>
 r3<span class="operator">.</span>isEmpty();               <span class="comment">// false</span>
</pre>


<h3 class="fn"><a name="numRects" />int QRegion.numRects (<i>self</i>)</h3><h3 class="fn"><a name="rectCount" />int QRegion.rectCount (<i>self</i>)</h3><p>Returns the number of rectangles that will be returned in
<a href="qregion.html#rects">rects</a>().</p>
<p>This function was introduced in Qt 4.6.</p>


<h3 class="fn"><a name="rects" />list-of-QRect QRegion.rects (<i>self</i>)</h3><p>Returns an array of non-overlapping rectangles that make up the
region.</p>
<p>The union of all the rectangles is equal to the original
region.</p>
<p><b>See also</b> <a href="qregion.html#setRects">setRects</a>().</p>


<h3 class="fn"><a name="subtract" /><a href="qregion.html">QRegion</a> QRegion.subtract (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>r</i>)</h3><h3 class="fn"><a name="subtracted" /><a href="qregion.html">QRegion</a> QRegion.subtracted (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>r</i>)</h3><p>Returns a region which is <i>r</i> subtracted from this
region.</p>
<p class="centerAlign"><img alt="Region Subtraction" src="images/rsubtract.png" /></p>
<p>The figure shows the result when the ellipse on the right is
subtracted from the ellipse on the left (<tt>left -
right</tt>).</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qregion.html#intersected">intersected</a>(), <a href="qregion.html#united">united</a>(), and <a href="qregion.html#xored">xored</a>().</p>


<h3 class="fn"><a name="swap" />QRegion.swap (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>other</i>)</h3><p>Swaps region <i>other</i> with this region. This operation is
very fast and never fails.</p>
<p>This function was introduced in Qt 4.8.</p>


<h3 class="fn"><a name="translate" />QRegion.translate (<i>self</i>, int&#160;<i>dx</i>, int&#160;<i>dy</i>)</h3><p>Translates (moves) the region <i>dx</i> along the X axis and
<i>dy</i> along the Y axis.</p>


<h3 class="fn"><a name="translate-2" />QRegion.translate (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p</i>)</h3><p>This is an overloaded function.</p>
<p>Translates the region <i>point</i><i>.x()</i> along the x axis
and <i>point</i><i>.y()</i> along the y axis, relative to the
current position. Positive values move the region to the right and
down.</p>
<p>Translates to the given <i>point</i>.</p>


<h3 class="fn"><a name="translated" /><a href="qregion.html">QRegion</a> QRegion.translated (<i>self</i>, int&#160;<i>dx</i>, int&#160;<i>dy</i>)</h3><p>Returns a copy of the region that is translated <i>dx</i> along
the x axis and <i>dy</i> along the y axis, relative to the current
position. Positive values move the region to the right and
down.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qregion.html#translate">translate</a>().</p>


<h3 class="fn"><a name="translated-2" /><a href="qregion.html">QRegion</a> QRegion.translated (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p</i>)</h3><p>This is an overloaded function.</p>
<p>Returns a copy of the regtion that is translated
<i>p</i><i>.x()</i> along the x axis and <i>p</i><i>.y()</i> along
the y axis, relative to the current position. Positive values move
the rectangle to the right and down.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also</b> <a href="qregion.html#translate">translate</a>().</p>


<h3 class="fn"><a name="unite" /><a href="qregion.html">QRegion</a> QRegion.unite (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>r</i>)</h3><h3 class="fn"><a name="united" /><a href="qregion.html">QRegion</a> QRegion.united (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>r</i>)</h3><p>Returns a region which is the union of this region and
<i>r</i>.</p>
<p class="centerAlign"><img alt="Region Union" src="images/runion.png" /></p>
<p>The figure shows the union of two elliptical regions.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qregion.html#intersected">intersected</a>(), <a href="qregion.html#subtracted">subtracted</a>(), and <a href="qregion.html#xored">xored</a>().</p>


<h3 class="fn"><a name="united-2" /><a href="qregion.html">QRegion</a> QRegion.united (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>r</i>)</h3><p>Returns a region which is the union of this region and the given
<i>rect</i>.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qregion.html#intersected">intersected</a>(), <a href="qregion.html#subtracted">subtracted</a>(), and <a href="qregion.html#xored">xored</a>().</p>


<h3 class="fn"><a name="xored" /><a href="qregion.html">QRegion</a> QRegion.xored (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>r</i>)</h3><p>Returns a region which is the exclusive or (XOR) of this region
and <i>r</i>.</p>
<p class="centerAlign"><img alt="Region XORed" src="images/rxor.png" /></p>
<p>The figure shows the exclusive or of two elliptical regions.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qregion.html#intersected">intersected</a>(), <a href="qregion.html#united">united</a>(), and <a href="qregion.html#subtracted">subtracted</a>().</p>


<h3 class="fn"><a name="__add__" /><a href="qregion.html">QRegion</a> QRegion.__add__ (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>r</i>)</h3><h3 class="fn"><a name="__add__-2" /><a href="qregion.html">QRegion</a> QRegion.__add__ (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>r</i>)</h3><h3 class="fn"><a name="__and__" /><a href="qregion.html">QRegion</a> QRegion.__and__ (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>r</i>)</h3><h3 class="fn"><a name="__and__-2" /><a href="qregion.html">QRegion</a> QRegion.__and__ (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>r</i>)</h3><h3 class="fn"><a name="__bool__" />int QRegion.__bool__ (<i>self</i>)</h3><h3 class="fn"><a name="__contains__" />int QRegion.__contains__ (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p</i>)</h3><h3 class="fn"><a name="__contains__-2" />int QRegion.__contains__ (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>r</i>)</h3><h3 class="fn"><a name="__eq__" />bool QRegion.__eq__ (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>r</i>)</h3><h3 class="fn"><a name="__iadd__" /><a href="qregion.html">QRegion</a> QRegion.__iadd__ (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>r</i>)</h3><h3 class="fn"><a name="__iadd__-2" /><a href="qregion.html">QRegion</a> QRegion.__iadd__ (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>r</i>)</h3><h3 class="fn"><a name="__iand__" /><a href="qregion.html">QRegion</a> QRegion.__iand__ (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>r</i>)</h3><h3 class="fn"><a name="__iand__-2" /><a href="qregion.html">QRegion</a> QRegion.__iand__ (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>r</i>)</h3><h3 class="fn"><a name="__ior__" /><a href="qregion.html">QRegion</a> QRegion.__ior__ (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>r</i>)</h3><h3 class="fn"><a name="__isub__" /><a href="qregion.html">QRegion</a> QRegion.__isub__ (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>r</i>)</h3><h3 class="fn"><a name="__ixor__" /><a href="qregion.html">QRegion</a> QRegion.__ixor__ (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>r</i>)</h3><h3 class="fn"><a name="__mul__" /><a href="qregion.html">QRegion</a> QRegion.__mul__ (<i>self</i>, <a href="qmatrix.html">QMatrix</a>&#160;<i>m</i>)</h3><h3 class="fn"><a name="__mul__-2" /><a href="qregion.html">QRegion</a> QRegion.__mul__ (<i>self</i>, <a href="qtransform.html">QTransform</a>&#160;<i>m</i>)</h3><h3 class="fn"><a name="__ne__" />bool QRegion.__ne__ (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>r</i>)</h3><h3 class="fn"><a name="__or__" /><a href="qregion.html">QRegion</a> QRegion.__or__ (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>r</i>)</h3><h3 class="fn"><a name="__sub__" /><a href="qregion.html">QRegion</a> QRegion.__sub__ (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>r</i>)</h3><h3 class="fn"><a name="__xor__" /><a href="qregion.html">QRegion</a> QRegion.__xor__ (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>r</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.9.5-9eb6aac99275 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.3</td></tr></table></div></address></body></html>